deploy/libmount: Fix build with old util-linux 2.23 (CentOS7)
authorColin Walters <walters@verbum.org>
Fri, 24 Feb 2017 15:18:27 +0000 (10:18 -0500)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 24 Feb 2017 17:24:15 +0000 (17:24 +0000)
commitcee57a0268334d51cd312c6cdcf367bedfd3e30d
tree7a6588bcea5e8e7ce16edddd7a0d30d7488c4c97
parent877a27da0fecc0b9e4ff3f79ae50efa32bbffd16
deploy/libmount: Fix build with old util-linux 2.23 (CentOS7)

https://github.com/ostreedev/ostree/pull/705 broke the build
on CentOS 7 which only has util-linux 2.23.

When I was thinking about this, I realized that there must really be a way to
make this safe even for older versions. Looking at that version of util-linux,
all we need to do is invert the order of frees so we `mnt_free_table()` *before*
`mnt_free_cache()`, like util-linux does:

https://github.com/karelzak/util-linux/blob/stable/v2.23/sys-utils/eject.c#L1131

We still use the `_unref()` versions if available.  I also fixed
the ordering there too for double plus redundant safety.

Closes: #712
Approved by: jlebon
configure.ac
src/libostree/ostree-sysroot-deploy.c